Add Execution Limits and Statistics Tracking to AgentForge #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces execution limits and statistics tracking to the AgentForge framework, allowing users to set timeouts for flow processing and collect performance metrics. These features enhance the framework's reliability and observability by preventing long-running processes and providing insights into execution performance.
Key Changes
1. Timeout Support
process_with_limitsfunctionality toFlowand exposed it through the top-level APITaskmodule with configurable duration2. Execution Statistics
ExecutionStatsmodule for collecting and analyzing flow execution metricsget_last_execution_stats3. Helper Functions
always_emit/2: Creates a handler that always emits a specified signal type and datafilter_type/2: Creates a handler that processes only signals of a specific typestore_in_state/1: Creates a handler that stores signal data in state under a given key4. Documentation and Examples
5. Backward Compatibility
Testing
Usage Example
This feature helps users prevent runaway executions and gain visibility into their workflows' performance characteristics, making AgentForge more robust for production environments.